package com.xdb.sqlparser.dialect.oracle.ast.clause;

import com.xdb.sqlparser.ast.SQLExpr;
import com.xdb.sqlparser.dialect.oracle.ast.OracleSQLObjectImpl;
import com.xdb.sqlparser.dialect.oracle.visitor.OracleASTVisitor;

public abstract class OracleFlashbackQueryClause extends OracleSQLObjectImpl {

	private Type type;

	public Type getType() {
		return type;
	}

	public void setType(Type type) {
		this.type = type;
	}

	public static enum Type {
		SCN, TIMESTAMP
	}

	public static class VersionsFlashbackQueryClause extends OracleFlashbackQueryClause {

		private SQLExpr begin;
		private SQLExpr end;

		public SQLExpr getBegin() {
			return begin;
		}

		public void setBegin(SQLExpr begin) {
			this.begin = begin;
		}

		public SQLExpr getEnd() {
			return end;
		}

		public void setEnd(SQLExpr end) {
			this.end = end;
		}

		@Override
		public void accept0(OracleASTVisitor visitor) {
			if (visitor.visit(this)) {
				acceptChild(visitor, begin);
				acceptChild(visitor, end);
			}
			visitor.endVisit(this);
		}
	}

	public static class AsOfFlashbackQueryClause extends OracleFlashbackQueryClause {

		private SQLExpr expr;

		public SQLExpr getExpr() {
			return expr;
		}

		public void setExpr(SQLExpr expr) {
			this.expr = expr;
		}

		@Override
		public void accept0(OracleASTVisitor visitor) {
			if (visitor.visit(this)) {
				acceptChild(visitor, expr);
			}
			visitor.endVisit(this);
		}
	}

	public static class AsOfSnapshotClause extends OracleFlashbackQueryClause {

		private SQLExpr expr;

		public SQLExpr getExpr() {
			return expr;
		}

		public void setExpr(SQLExpr expr) {
			this.expr = expr;
		}

		@Override
		public void accept0(OracleASTVisitor visitor) {
			if (visitor.visit(this)) {
				acceptChild(visitor, expr);
			}
			visitor.endVisit(this);
		}
	}
}
